package com.soup.lab.spring.boot.config;

import com.soup.lab.spring.boot.config.config.SimpleConfiguration;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class SimpleConfigurationTestCase {

    @Autowired
    SimpleConfiguration.ConfigHolder configHolder;

    @Test
    public void test() {
        Assertions.assertNotNull(configHolder);
        Assertions.assertNotNull(configHolder.getConfig());
    }

    @Autowired
    @Qualifier("conditionalConfig")
    SimpleConfiguration.ConfigHolder conditionalConfigHolder;

    @Test
    public void testConditional() {
        Assertions.assertNotNull(conditionalConfigHolder);
        Assertions.assertNotNull(conditionalConfigHolder.getConfig());
    }

}
